package com.xiaoxiao.springbootstudy.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.xiaoxiao.springbootstudy.pojo.AfterScale;
import com.xiaoxiao.springbootstudy.pojo.vo.CountResult;
import com.xiaoxiao.springbootstudy.service.AfterScaleService;
import com.xiaoxiao.springbootstudy.mapper.AfterScaleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
* @author XiaoXiao
* @description 针对表【t_after_scales】的数据库操作Service实现
* @createDate 2025-05-13 14:45:56
*/
@Service
public class AfterScaleServiceImpl extends ServiceImpl<AfterScaleMapper, AfterScale>
    implements AfterScaleService{

    @Autowired
    private AfterScaleMapper afterScaleMapper;

    @Override
    public Map<String, Object> queryAfterSaleListService(AfterScale afterScale) {
        Map<String, Object> map = new HashMap<>();
        Page page = PageHelper.startPage(afterScale.getPageNum(), afterScale.getPageSize());
        List list = afterScaleMapper.queryAfterSaleListMapper(afterScale);
        map.put("total", page.getTotal());
        map.put("list", list);
        return map;
    }

    @Override
    public List<CountResult> countQuestionTypeService() {
        return afterScaleMapper.countQuestionTypeMapper();
    }

    @Override
    public List<CountResult> countStateService() {
        return afterScaleMapper.countStateMapper();
    }
}




